
package generator.statements;

import java.util.Random;

/**
 * OfferAttraction SQL record mapper.
 * 
 * @author Necro
 * @author Marek Snopkowski <snpy@snpy.info>
 * @version 11.04.2008
 */
public class OfferAttraction extends Statement
{
    private Attraction attraction;
    private Offer offer;
    
    private int allInclusive;
    
    public Object[] getFieldsValueCollection()
    {
        return new Object[]{ attraction.getId(), offer.getId(), allInclusive };
    }
    
    public String getFieldsNameSet()
    {
        return "[attraction_id], [offer_id], [all_inclusive]";
    }

    public OfferAttraction(Attraction attraction, Offer offer) 
    {
        this.attraction   = attraction;
        this.offer        = offer;        
        this.allInclusive = ((new Random()).nextInt(100) < 20) ? 1 : 0;
    }

    public Attraction getAttraction()
    {
        return attraction;
    }

    public Offer getOffer()
    {
        return offer;
    }
    
     @Override
    public String getTableName()
    {
        return "offer_attraction";
    }
    
}
